package com.kede.app.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @description /
* @author Pr.li
* @date 2023-07-02
**/
@Entity
@Data
@Table(name="t_zhi_imgs")
@EntityListeners(AuditingEntityListener.class)
public class ZhiImgs implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 置换分类的末节点id
    */
    @ApiModelProperty(value = "置换分类的末节点id")
    @Column(name = "`node_id`",nullable = false)
    @NotNull
    private Integer nodeId;
    /**
    * 图片要求多个用，分开
    */
    @ApiModelProperty(value = "图片要求多个用，分开")
    @Column(name = "`values`",nullable = false)
    @NotBlank
    private String values;
    /**
    * 
    */
    @ApiModelProperty(value = "createTime")
    @Column(name = "`create_time`",nullable = false)
    @CreatedDate
    private Timestamp createTime;
    /**
    * 
    */
    @ApiModelProperty(value = "updateTime")
    @Column(name = "`update_time`",nullable = false)
    @LastModifiedDate
    private Timestamp updateTime;
    /**
    * 
    */
    @ApiModelProperty(value = "createBy")
    @Column(name = "`create_by`",nullable = false)
    @CreatedBy
    private String createBy;
    /**
    * 
    */
    @ApiModelProperty(value = "updateBy")
    @Column(name = "`update_by`",nullable = false)
    @LastModifiedBy
    private String updateBy;

    public void copy(ZhiImgs source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
